<template>
	<view class="map-location-container">
		<image class="main-img" src="https://hxs.dsjhs.com:553/prod-api/profile/maplocation.png" mode="widthFix">
		</image>
		<view class="footer">
			<button type="default" class="footer-btn" @tap="handlePay">解锁查看更多报告</button>
		</view>
	</view>
</template>

<script>
	import {
		transactions
	} from '@/common/api.js'
	export default {

		name: '',
		data() {
			return {

			}
		},
		onLoad(option) {},
		methods: {
			async handlePay() {
				uni.showLoading({
					mask: true,
					title: '正在支付中...'
				})
				const res = await transactions()
				if (res.code == 200) {
					let config = res.data
					uni.requestPayment({
						provider: 'wxpay',
						timeStamp: config.timeStamp.toString(),
						nonceStr: config.nonceStr,
						package: 'prepay_id=' + config.package.prepay_id,
						signType: config.signType,
						paySign: config.paySign,
						success() {
							uni.hideLoading()
							uni.showToast({
								title: '支付成功',
								icon: 'success',
								success() {
									// uni.redirectTo({
									// 	url: '/groupPurchase/order/buysuccess?id=' + order_id
									// })
								}
							})
						},
						fail(err) {
							console.log(222, err);
							uni.hideLoading()
							uni.showToast({
								title: '支付取消',
								icon: 'error'
							})

						}
					})
				}
				uni.hideLoading()

			},
		}
	}
</script>

<style lang="scss" scoped>
	.map-location-container {
		width: 100%;
		min-height: 100vh;
		padding-bottom: 40rpx;
		background-color: #fff;

		.main-img {
			width: 100% !important;
			// min-height: 100vh;
		}

		.footer-btn {
			position: fixed;
			left: 5%;
			bottom: 40rpx;
			width: 90%;
			margin: 0 auto;
			font-weight: 600;
			border-radius: 16rpx;
			color: #fff;
			background-color: #2878ff;
			z-index: 999;

			&::after {
				border: 0;
			}
		}
	}
</style>